#!/usr/bin/env python

import sys, binascii
import re
import difflib

f_left = open('left', 'w')
f_right = open('right', 'w')
line = sys.stdin.readline()
while line:
    left = line[:53].strip()
    right = line[56:].strip()
    if len(left) > 0:
        f_left.write(left + '\n')
    if len(right) > 0:
        f_right.write(right + '\n')
    line = sys.stdin.readline()
f_left.close()
f_right.close()

f_left = open('left', 'r')
f_right = open('right', 'r')
diffs = difflib.ndiff(f_left.readlines(), f_right.readlines())
f_left.close()
f_right.close()

f_left = open('left.png', 'wb')
f_right = open('right.png', 'wb')
f_middle = open('middle.png', 'wb')
for line in diffs:
    content = binascii.unhexlify(''.join(line[2:].split()))
    if line[0] == '-':
        f_left.write(content)
    elif line[0] == '+':
        f_right.write(content)
    else:
        f_middle.write(content)
f_left.close()
f_right.close()
f_middle.close()

